﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace WebOS.Controllers
{
    public class TestModel1
    {
        public string UserName { get; set; }
        public string Sex { get; set; }
        public string Age { get; set; }
        public string XueHao { get; set; }
        public string BanJi { get; set; }
    }
    public class UserInfo
    {
        public string Name { get; set; }
        public string Password { get; set; }
    }
    public class HomeController : Controller
    {
        //
        // GET: /Home/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Calendar()
        {
            return View();
        }
        public JsonResult Test(string name, string password)
        {
            return Json(new TestModel1()
                            {
                                UserName = name,
                                Sex = "男",
                                Age = "21",
                                XueHao = "北大",
                                BanJi = "计算机一班"
                            }, JsonRequestBehavior.AllowGet);
            
        }
        public ActionResult Test2(string name, string password)
        {
            if (name == "jack" && password == "jack")
            {
                return Content("{success:true,name:'" + name + "'}");
            }
            return Content("{success:false,name:'" + name + "'}");
        }

        public JsonResult GetInfo(string name)
        {
            var litestModel = new List<TestModel1>
                                  {
                                      new TestModel1()
                                          {
                                              UserName = name,
                                              Sex = "男",
                                              Age = "21",
                                              XueHao = "北大",
                                              BanJi = "计算机一班"
                                          },
                                      new TestModel1()
                                          {
                                              UserName = "李男",
                                              Sex = "女",
                                              Age = "22",
                                              XueHao = "清华",
                                              BanJi = "中文系一班"
                                          }
                                  };
            return Json(litestModel, JsonRequestBehavior.AllowGet);
        }
    }
}
